package com.mcxx.modules.miniSalvation.family.service.read;

import com.mcxx.modules.base.utils.QueryParamUtil;
import com.mcxx.modules.miniSalvation.family.dao.read.FamilySpecialReadDao;
import com.mcxx.modules.miniSalvation.family.dto.FamilySpecialObjectDTO;
import com.mcxx.modules.miniSalvation.family.entity.FamilySpecialEntity;
import com.mcxx.modules.miniSalvation.family.param.FamilySpecialParam;
import com.yinhai.ta404.core.restservice.requestbean.PageParam;
import com.yinhai.ta404.core.restservice.resultbean.Page;
import com.yinhai.ta404.core.security.vo.UserAccountVo;
import com.yinhai.ta404.core.service.BaseService;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@TaTransactional(readOnly = true)
public class SpecialPeopleReadService extends BaseService {
    @Autowired
    private FamilySpecialReadDao familySpecialReadDao;


    public FamilySpecialEntity getSpecialPeopleById(String id) {
        return familySpecialReadDao.queryFamilySpecialById(id);
    }


    public List<FamilySpecialEntity> getFamilySpecialList(String familyId) {
        return familySpecialReadDao.querFamilyspecialByFamilyId(familyId);
    }


    public Page<FamilySpecialObjectDTO> listByCondition(FamilySpecialParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);


        familySpecialReadDao.beginPager(pageParam);
        List<FamilySpecialObjectDTO>list=familySpecialReadDao.getFamilySpecials(param);


        return familySpecialReadDao.endPager(list);
    }


    public String getIdByFamilyIdAndIdcard(String familyId, String idcard) {
        return familySpecialReadDao.getIdByFamilyIdAndIdcard(familyId,idcard);
    }



    public int cntFamilySpecialNum(String familyId){
        return familySpecialReadDao.cntFamilySpecialNum(familyId);
    }
}
